<?xml version="1.0" encoding="UTF-8"?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:p="http://primefaces.org/ui"
     template="Template.xhtml"
>
<ui:define name="title"></ui:define>

<ui:define name="body">

<script>

var i=0;
function d()
{
	
	document.getElementById("g:a").value="#{testMB.list[0]}";
	alert("#{testMB.list[0]}");
}
function add()
{
	
	b='<button id="j_idt85:j_idt87" name="j_idt85:j_idt87" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="remove_this('+i+');PrimeFaces.ab({source:\'j_idt85:j_idt87\'});return false;" type="submit" role="button" aria-disabled="false"><span class="ui-button-text ui-c">remove</span></button>';
   
    c='a';
    alert(c);
	$('#ici').append('<div id="'+i+'">'+b+''+c+'</div>');
	i++;
	
}
function remove_this(m){
	$('#'+m).remove();	
	i--;
}

</script>
<input type="button" value="gh" onclick="add()"/>
 <br/> <br/> <br/>

<h:form id="g">
    <p:commandButton value="click" onclick="add()" actionListener="#{testMB.AJOUTER}"/>
    <p:commandButton value="remove" onclick="remove_this(1)" actionListener="#{testMB.remove('1')}"/>
  <p:commandButton value="ff" action="#{testMB.a()}" />
  <p:panelGrid columns="1">
  <p:outputLabel value="GLN (Global Location Number) GIS" />
  <h:inputText  value="#{testMB.list[0]}"/>
<input type="Text"  id="a"  value="#{testMB.list[0]}"/>
<input type="button" value="jjj"  onclick="d()" />
<div id="ici">
</div>
 </p:panelGrid>

    
</h:form>
<p:selectOneMenu >
<f:selectItems   value="#{testMB.listeTr()}" var="a" itemLabel="#{a.idTransportCat}" itemValue="#{a.intitule}" />
</p:selectOneMenu>

</ui:define>
</ui:composition>